﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace DynaCAD
{
    /// <summary>
    /// Interaction logic for New_File.xaml
    /// </summary>
    public partial class New_File : Window
    {
        private double _width = 0;
        private double _height = 0;
        public double WidthVB
        {
            get
            {
                return _width;
            }
            set
            {
                _width = value;
            }
        }
        public double HeightVB
        {
            get { return _height; }
            set { _height = value; }
        }

        public New_File()
        {
            InitializeComponent();
        }

        private void Create_New_File(object sender, RoutedEventArgs e)
        {
            try
            {
                WidthVB = Convert.ToDouble(Width.Text);
            }
            catch { Width.Text = "0"; MessageBox.Show("Sayı Girmeniz Gerekmektedir."); return; }
            try
            {
                HeightVB = Convert.ToDouble(Height.Text);
            }
            catch { Width.Text = "0"; MessageBox.Show("Sayı Girmeniz Gerekmektedir."); return; }

            ((NewPartCreator)(Application.Current.Windows.OfType<NewPartCreator>().First<NewPartCreator>())).CreateNewFile(WidthVB, HeightVB);

            this.Close();


        }

        private void Cancel_Clik(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
